
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:massagist/models/path_model_entity.dart';
import 'package:massagist/views/mass_appbar.dart';

import '../generated/l10n.dart';
import '../manager/config.dart';

class PathInfoPage extends StatefulWidget {
  PathModelEntity model;
  PathInfoPage({required this.model});
  @override
  State<PathInfoPage> createState() => PathInfoPageState();
}

class PathInfoPageState extends State<PathInfoPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: [
          Container(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Container(
                  width: ScreenUtil().screenWidth,
                  height: ScreenUtil().screenWidth,
                  child: ClipRRect(
                    child: Image.network(
                      widget.model.icon, fit: BoxFit.cover,
                    ),
                  ),
                ),
                Container(
                  margin: EdgeInsets.only(top: 12.sp, left: 12.sp, right: 12.sp),
                  height: 37.sp,
                  alignment: Alignment.topLeft,
                  child: Text(
                    widget.model.line,
                    maxLines: 2,
                    style: TextStyle(
                        fontWeight: FontWeight.w700, fontSize: 13.sp, color: Color(0xFF333333)
                    ),
                  ),
                ),

                Container(
                  margin: EdgeInsets.only(left: 12.sp),
                  child: Stack(
                    children: [
                      Container(
                        margin: EdgeInsets.only(left: 34.sp),
                        child: Image.asset("assets/images/star_mask.png", width: 34.sp, height: 34.sp,),
                      ),
                      Container(
                        height: 20.sp,
                        margin: EdgeInsets.only(top: 4.sp),
                        child: Text(S.current.MASSGE_DETAIL, style: TextStyle(fontSize: 14.sp, fontWeight: FontWeight.w700, color: Color(0xFF110604))),
                      ),
                    ],
                  ),
                ),
                Expanded(
                  child: Container(
                    margin: EdgeInsets.only(left: 12.sp, top: 5.sp, right: 12.sp),
                    child: GridView.count(
                      padding: EdgeInsets.only(top: 0.sp),
                      scrollDirection: Axis.vertical,
                      crossAxisCount: 2,
                      mainAxisSpacing: 12.sp,
                      crossAxisSpacing: 7.sp,
                      childAspectRatio: (172.0 / 225),
                      children: widget.model.users.map((e) {
                        return Container(
                          height: 225.sp,
                          child: Column(
                            children: [
                              Container(
                                width: 172.sp,
                                height: 172.sp,
                                child: ClipRRect(
                                  borderRadius: BorderRadius.circular(8.sp),
                                  child: Image.network(
                                    e.icon, fit: BoxFit.cover,
                                  ),
                                ),
                              ),
                              Container(
                                alignment: Alignment.centerLeft,
                                height: 53.sp,
                                child: Column(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: [
                                    Container(
                                      margin: EdgeInsets.only(top: 5.sp),
                                      height: 23.sp,
                                      child: Text(e.name, style: TextStyle(fontSize: 16.sp, fontWeight: FontWeight.w700, color: Color(0xFF110604))),
                                    ),

                                    Container(
                                      margin: EdgeInsets.only(top: 6.sp),
                                      child: Text(e.height.toString() + "cm | " + e.weight, style: TextStyle(fontSize: 12.sp, fontWeight: FontWeight.w500, color: Color(0xFF999999))),
                                    )
                                  ],
                                ),
                              )
                            ],
                          ),
                        );
                      }).toList(),
                    ),
                  ),
                )
              ],
            ),
          ),
          // MassAppbar(title: S.current.MASSGE_DETAIL,)

          Container(
            padding: EdgeInsets.only(bottom: 10.sp),
            height: 88.sp,
            alignment: Alignment.bottomCenter,
            child: MassAppbar(title: S.current.MASSGE_DETAIL,),
          ),
        ],
      ),
    );
  }
}